<%@ Control Language="VB" AutoEventWireup="false" CodeFile="AddClient.ascx.vb" Inherits="Controls_AddClient" %>
<table>
    <tr>
        <td style="width: 100px; height: 21px; text-align: right">
            Client Name</td>
        <td style="width: 186px; height: 21px">
            <asp:TextBox ID="txtClientName" runat="server" AutoPostBack="True" Width="182px"></asp:TextBox></td>
    </tr>
    <tr>
        <td style="width: 100px; text-align: right">
            Clients</td>
        <td style="width: 186px">
            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="ObjectDataSource1"
                DataTextField="ClientName" DataValueField="ClientID" Width="180px">
            </asp:DropDownList>
        </td>
    </tr>
</table>
<br />
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" CellPadding="4"
    DataKeyNames="ClientID" DataSourceID="ObjectDataSource2" ForeColor="#333333"
    GridLines="None" Height="50px" Width="334px">
    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
    <EditRowStyle BackColor="#999999" />
    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
    <Fields>
        <asp:BoundField DataField="ClientName" HeaderText="ClientName" SortExpression="ClientName" />
        <asp:TemplateField HeaderText="StatusID" SortExpression="StatusID">
            <EditItemTemplate>
                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("StatusID") %>'></asp:TextBox>
            </EditItemTemplate>
            <InsertItemTemplate>
                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("StatusID") %>'></asp:TextBox>
            </InsertItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# Bind("StatusID") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="ContractStartDate" HeaderText="ContractStartDate" SortExpression="ContractStartDate" />
        <asp:BoundField DataField="ContractEndDate" HeaderText="ContractEndDate" SortExpression="ContractEndDate" />
        <asp:BoundField DataField="ContactName" HeaderText="ContactName" SortExpression="ContactName" />
        <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
        <asp:BoundField DataField="Fax" HeaderText="Fax" SortExpression="Fax" />
        <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
        <asp:BoundField DataField="StreetAddress" HeaderText="StreetAddress" SortExpression="StreetAddress" />
        <asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
        <asp:BoundField DataField="ProvinceState" HeaderText="ProvinceState" SortExpression="ProvinceState" />
        <asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country" />
        <asp:BoundField DataField="PostalCode" HeaderText="PostalCode" SortExpression="PostalCode" />
        <asp:BoundField DataField="ClientID" HeaderText="ClientID" ReadOnly="True" SortExpression="ClientID"  />
        <asp:BoundField DataField="ContactInfoID" HeaderText="ContactInfoID" SortExpression="ContactInfoID" />
        <asp:BoundField DataField="LocationID" HeaderText="LocationID" SortExpression="LocationID" />
        <asp:CommandField ShowEditButton="True" ShowInsertButton="True"  />
    </Fields>
    <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:DetailsView>
<br />
<br />
<br />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" InsertMethod="CreateClient"
    SelectMethod="LookupClientbyClientName"
    TypeName="GTSSystem.BLL.Client" UpdateMethod="UpdateClient">
    <UpdateParameters>
        <asp:Parameter Name="ClientId" Type="Int32" />
        <asp:Parameter Name="ContactInfoId" Type="Int32" />
        <asp:Parameter Name="LocationId" Type="Int32" />
        <asp:Parameter Name="ClientName" Type="String" />
        <asp:Parameter Name="StatusId" Type="Int32" />
        <asp:Parameter Name="ContractStartDate" Type="DateTime" />
        <asp:Parameter Name="ContractEndDate" Type="DateTime" />
        <asp:Parameter Name="ContactName" Type="String" />
        <asp:Parameter Name="Phone" Type="String" />
        <asp:Parameter Name="Fax" Type="String" />
        <asp:Parameter Name="Email" Type="String" />
        <asp:Parameter Name="StreetAddress" Type="String" />
        <asp:Parameter Name="City" Type="String" />
        <asp:Parameter Name="ProvinceState" Type="String" />
        <asp:Parameter Name="Country" Type="String" />
        <asp:Parameter Name="PostalCode" Type="String" />
    </UpdateParameters>
    <SelectParameters>
        <asp:ControlParameter ControlID="txtClientName" ConvertEmptyStringToNull="False"
            Name="ClientName" PropertyName="Text" Type="String" />
    </SelectParameters>
    <InsertParameters>
        <asp:Parameter Name="ClientName" Type="String" />
        <asp:Parameter Name="StatusId" Type="Int32" />
        <asp:Parameter Name="ContractStartDate" Type="DateTime" />
        <asp:Parameter Name="ContractEndDate" Type="DateTime" />
        <asp:Parameter Name="ContactName" Type="String" />
        <asp:Parameter Name="Phone" Type="String" />
        <asp:Parameter Name="Fax" Type="String" />
        <asp:Parameter Name="Email" Type="String" />
        <asp:Parameter Name="StreetAddress" Type="String" />
        <asp:Parameter Name="City" Type="String" />
        <asp:Parameter Name="ProvinceState" Type="String" />
        <asp:Parameter Name="Country" Type="String" />
        <asp:Parameter Name="PostalCode" Type="String" />
    </InsertParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" InsertMethod="CreateClient"
    OldValuesParameterFormatString="original_{0}" SelectMethod="LookupClientbyClientId"
    TypeName="GTSSystem.BLL.Client" UpdateMethod="UpdateClient">
    <UpdateParameters>
        <asp:Parameter Name="ClientId" Type="Int32" />
        <asp:Parameter Name="ContactInfoId" Type="Int32" />
        <asp:Parameter Name="LocationId" Type="Int32" />
        <asp:Parameter Name="ClientName" Type="String" />
        <asp:Parameter Name="StatusId" Type="Int32" />
        <asp:Parameter Name="ContractStartDate" Type="DateTime" />
        <asp:Parameter Name="ContractEndDate" Type="DateTime" />
        <asp:Parameter Name="ContactName" Type="String" />
        <asp:Parameter Name="Phone" Type="String" />
        <asp:Parameter Name="Fax" Type="String" />
        <asp:Parameter Name="Email" Type="String" />
        <asp:Parameter Name="StreetAddress" Type="String" />
        <asp:Parameter Name="City" Type="String" />
        <asp:Parameter Name="ProvinceState" Type="String" />
        <asp:Parameter Name="Country" Type="String" />
        <asp:Parameter Name="PostalCode" Type="String" />
    </UpdateParameters>
    <SelectParameters>
        <asp:ControlParameter ControlID="DropDownList1" Name="ClientId" PropertyName="SelectedValue"
            Type="Int32" />
    </SelectParameters>
    <InsertParameters>
        <asp:Parameter Name="ClientName" Type="String" />
        <asp:Parameter Name="StatusId" Type="Int32" />
        <asp:Parameter Name="ContractStartDate" Type="DateTime" />
        <asp:Parameter Name="ContractEndDate" Type="DateTime" />
        <asp:Parameter Name="ContactName" Type="String" />
        <asp:Parameter Name="Phone" Type="String" />
        <asp:Parameter Name="Fax" Type="String" />
        <asp:Parameter Name="Email" Type="String" />
        <asp:Parameter Name="StreetAddress" Type="String" />
        <asp:Parameter Name="City" Type="String" />
        <asp:Parameter Name="ProvinceState" Type="String" />
        <asp:Parameter Name="Country" Type="String" />
        <asp:Parameter Name="PostalCode" Type="String" />
    </InsertParameters>
</asp:ObjectDataSource>
